package com.pipi.sso.dao.manager.impl;

import com.pipi.sso.dao.support.PageResult;
import com.pipi.sso.dao.model.ClassesDO;
import com.pipi.sso.dao.query.ClassesQuery;
import com.pipi.sso.dao.mapper.ext.ClassesExtMapper;
import com.pipi.sso.dao.manager.ClassesManager;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for Classes.
 */

@Component
public class ClassesManagerImpl implements ClassesManager{

    
    @Autowired
    protected ClassesExtMapper classesExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(ClassesQuery query){
        return classesExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(ClassesQuery query){
        return classesExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(ClassesDO record){
        return classesExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(ClassesDO record){
        return classesExtMapper.insertSelective(record);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<ClassesDO> selectByQuery(ClassesQuery query){
        return classesExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<ClassesDO> selectByQueryWithPage(ClassesQuery query) {
        PageResult<ClassesDO> result = new PageResult<ClassesDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public ClassesDO selectByPrimaryKey(Long id){
        return classesExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( ClassesDO record,  ClassesQuery query){
        return classesExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( ClassesDO record,  ClassesQuery query){

        return classesExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(ClassesDO record){
        return classesExtMapper.updateByPrimaryKeySelective(record);
    }
}